import {fetch} from "@/config/fetch";

export const loginTo=(name:string,password:string) =>fetch('admin/login/userLogin',{name:name,password:password},"POST");

export const addEssay=(title:string,headImg:string,table:string,textInfo:string,summary:string)=>fetch('admin/Essay/addEssay',{title:title,headImg:headImg,table:table,textInfo:textInfo,summary:summary},"POST")


export const selectEssay=(page:number)=>fetch('admin/Essay/selectEssay',{page:page},"POST");

export const deleteEssay=(id:string)=>fetch('admin/Essay/deleteEssay',{id:id},"POST");

export const selectIdEssay=(id:string)=>fetch('admin/Essay/selectIdEssay',{id:id},"POST")

export const updateEssay=(id:string,title:string,headImg:string,table:string,textInfo:string,summary:string)=>fetch('admin/Essay/updateEssay',{id:id,title:title,headImg:headImg,table:table,textInfo:textInfo,summary:summary},"POST")

export const selectAllLog=(page:number,like='0')=>fetch('admin/Log/selectAllLog',{page:page,like:like},"POST")

export const addLinks=(linkName:string,linkUrl:string,linkImg:string)=>fetch('admin/Links/addLinks',{linkName:linkName,linkUrl:linkUrl,linkImg:linkImg},"POST")

export const selectLinkAll=()=>fetch('admin/Links/selectLinkAll',null,"GET");

export const deleteLinks=(id:string)=>fetch('admin/Links/deleteLinks',{id:id},"POST");

export const selectTextEssay=(text:string)=>fetch('admin/Essay/selectTextEssay',{text:text},"POST")

export const selectMessage=()=>fetch('admin/Essay/selectMessage',null,"GET");